`include "defines.v"
module ysyx_210448_ID_EXE (
    input clk,
    input wire rst,
    input wire id_fetched,
    input wire id_exe_en,
    input wire id_mem_read,
    input wire id_exe_bubble,
    input wire id_csr_skip,
    input wire id_w_ena,
    input reg [63:0] id_pc,
    input reg [31:0] id_inst,
    input reg [63:0] id_op1,
    input reg [63:0] id_op2,
    input reg [63:0] id_t,
    input reg [4:0] id_rs1,
    input reg [4:0] id_rs2,
    input reg [4 : 0]id_rd,
    input reg [6:0] id_opcode,
    input reg [19 : 0]id_u_imm,
    input reg [19 : 0]id_j_imm,
    input reg [11 : 0]id_j_imm_j,
    input reg [11 : 0]id_i_imm, 
    input reg [11 : 0]id_I_imm,
    input reg [6 : 0]id_b_imm,
    input reg [6 : 0]id_s_imm,
    input reg [4 : 0]id_s_imm_s,
    input reg [4 : 0]id_b_imm_b,
    input reg [11:0]id_w_imm,
    input reg [5:0]id_w_shamt,
    input reg [2:0] id_s1,
    input reg id_s2,
    input reg [5:0]id_shamt,
    input reg [11:0]id_csr,
    input reg [4:0]id_zimm,
    input reg id_csr_read,
    input reg id_csr_write,

    output reg [63:0] exe_pc,
    output reg [31:0] exe_inst,
    output reg exe_fetched,
    output reg exe_csr_skip,
    output reg exe_mem_read,
    output reg exe_w_ena,
    output reg [63:0] exe_op1,
    output reg [63:0] exe_op2,
    output reg [63:0] exe_t,
    output reg [4:0] rs1,
    output reg [4:0] rs2,
    output reg [4 : 0]exe_rd,
    output reg [6:0] exe_opcode,
    output reg [19 : 0]exe_u_imm,
    output reg [19 : 0]exe_j_imm,
    output reg [11 : 0]exe_j_imm_j,
    output reg [11 : 0]exe_i_imm, 
    output reg [11 : 0]exe_I_imm,
    output reg [6 : 0]exe_b_imm,
    output reg [6 : 0]exe_s_imm,
    output reg [4 : 0]exe_s_imm_s,
    output reg [4 : 0]exe_i_imm_i,
    output reg [4 : 0]exe_b_imm_b,
    output reg [11:0]exe_w_imm,
    output reg [5:0]exe_w_shamt,
    output reg [2:0] exe_s1,
    output reg exe_s2,
    output reg [5:0]exe_shamt,
    output reg [11:0]exe_csr,
    output reg [4:0]exe_zimm,
    output reg exe_csr_read,
    output reg exe_csr_write
  );

      always @(posedge clk) begin
        if(rst==1'b1)
        begin
        exe_pc<=64'b0;
        exe_inst<=32'b0;
        exe_op1<=64'b0;
        exe_op2<=64'b0;
        exe_t<=64'b0;
        exe_rd<=5'b0;
        exe_opcode<=7'b0;
        exe_u_imm<=20'b0;
        exe_j_imm<=20'b0;
        exe_j_imm_j<=12'b0;
        exe_i_imm<=12'b0;
        exe_I_imm<=12'b0;
        exe_b_imm<=7'b0;
        exe_s_imm<=7'b0;
        exe_s_imm_s<=5'b0;
        exe_i_imm_i<=5'b0;
        exe_b_imm_b<=5'b0;
        exe_w_imm<=12'b0;
        exe_w_shamt<=6'b0;
        exe_s1<=3'b0;
        exe_s2<=1'b0;
        exe_shamt<=6'b0;
        exe_csr<=12'b0;
        exe_zimm<=5'b0;
        exe_mem_read<=1'b0;
        exe_csr_read<=1'b0;
        exe_csr_write<=1'b0;
        exe_csr_skip<=1'b0;
        exe_fetched<=1'b0;
        exe_w_ena<=1'b0;
        rs1<=5'b0;
        rs2<=5'b0;
        end
        else if(id_exe_en)
        begin
          if(id_exe_bubble==1'b1)
          begin
            exe_pc<=64'b0;
            exe_inst<=32'b0;
            exe_op1<=64'b0;
            exe_op2<=64'b0;
            exe_t<=64'b0;
            exe_rd<=5'b0;
            exe_opcode<=7'b0;
            exe_u_imm<=20'b0;
            exe_j_imm<=20'b0;
            exe_j_imm_j<=12'b0;
            exe_i_imm<=12'b0;
            exe_I_imm<=12'b0;
            exe_b_imm<=7'b0;
            exe_s_imm<=7'b0;
            exe_s_imm_s<=5'b0;
            exe_i_imm_i<=5'b0;
            exe_b_imm_b<=5'b0;
            exe_w_imm<=12'b0;
            exe_w_shamt<=6'b0;
            exe_s1<=3'b0;
            exe_s2<=1'b0;
            exe_shamt<=6'b0;
            exe_csr<=12'b0;
            exe_zimm<=5'b0;
            exe_mem_read<=1'b0;
            exe_csr_read<=1'b0;
            exe_csr_write<=1'b0;
            exe_csr_skip<=1'b0;
            exe_fetched<=1'b0;
            exe_w_ena<=1'b0;
            rs1<=5'b0;
            rs2<=5'b0;
          end
          else
          begin
            exe_pc<=id_pc;
            exe_inst<=id_inst;
            exe_op1<=id_op1;
            exe_op2<=id_op2;
            exe_t<=id_t;
            exe_rd<=id_rd;
            exe_opcode<=id_opcode;
            exe_u_imm<=id_u_imm;
            exe_j_imm<=id_j_imm;
            exe_j_imm_j<=id_j_imm_j;
            exe_I_imm<=id_I_imm;
            exe_b_imm<=id_b_imm;
            exe_b_imm_b<=id_b_imm_b;
            exe_s_imm<=id_s_imm;
            exe_s_imm_s<=id_s_imm_s;
            exe_i_imm<=id_i_imm;
            exe_b_imm<=id_b_imm;
            exe_w_imm<=id_w_imm;
            exe_w_shamt<=id_w_shamt;
            exe_s1<=id_s1;
            exe_s2<=id_s2;
            exe_shamt<=id_shamt;
            exe_csr<=id_csr;
            exe_zimm<=id_zimm;
            exe_mem_read<=id_mem_read;
            exe_csr_read<=id_csr_read;
            exe_csr_write<=id_csr_write;
            exe_csr_skip<=id_csr_skip;
            exe_fetched<=id_fetched;
            exe_w_ena<=id_w_ena;
            rs1<=id_rs1;
            rs2<=id_rs2;
          end
        
    end
      end
  endmodule
